#include "node.h"

Node::Node(const vector<Node*>& nodes) : out_shape_(new Shape(0, 0)), 
                node_in_list_(new vector<Node*>()), 
                node_out_list_(new vector<Node*>()) {
    for(auto node : nodes) {
        addNodeIn(node);
        node -> addNodeOut(this);
    }
    if(nodes.size() > 0)
        setOutShape(nodes[0] -> getOutShape());
}

Node::~Node() {
    if(node_in_list_) delete node_in_list_;
    if(node_out_list_) delete node_out_list_;
    if(out_shape_) delete out_shape_;
}

void Node::setOutShape(const Shape* shape) {
    out_shape_ -> rows = shape -> rows;
    out_shape_ -> cols = shape -> cols;
}
